package com.share.device.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.share.device.domain.Cabinet;
import com.share.device.domain.CabinetSlot;
import com.share.device.mapper.CabinetSlotMapper;
import com.share.device.service.ICabinetSlotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CabinetSlotServiceImpl extends ServiceImpl<CabinetSlotMapper, CabinetSlot> implements ICabinetSlotService {

    @Autowired
    private CabinetSlotMapper cabinetSlotMapper;

    //查询指定id的柜机的指定编号的插槽中的充电宝
    @Override
    public CabinetSlot getBtSlotNo(Long cabinetId, String slotNo) {
        LambdaQueryWrapper<CabinetSlot> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CabinetSlot::getCabinetId,cabinetId) //插槽所在柜机编号
                .eq(CabinetSlot::getSlotNo,slotNo);  //插槽编号

        CabinetSlot cabinetSlot = cabinetSlotMapper.selectOne(wrapper);

        return cabinetSlot;
    }
}
